package com.huawei.appmarket.oobe.store;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.text.TextUtils;
import androidx.annotation.RequiresApi;
import com.huawei.appgallery.serverreqkit.api.bean.BaseResponseBean;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import o.bke;
import o.cvt;
import o.BaseRequest;
import o.dld;
import o.dli;
import o.dlw;
import o.Logger;
import o.doi;
import o.ContentManager;
import o.epr;
import o.ll;

@RequiresApi(api = 26)
public class OOBEQueryIfSupportTaskV2 extends dlw {
    private int ॱ = 0;

    public static class OOBESupportResponseV2 extends BaseResponseBean {
        public static final int SUCCESS = 0;
        private int appUpdateNotify_ = 0;
        private String channelInfo_;
        private String desktopLayout_;
        private int isNotifyNotRemoveable_;
        private int isServiceZone_;
        private int isSimChangeNotify_ = 0;
        private int maxDisplay_;
        private int notifyIntervalTime_;
        private int oobeMarket_;
        private int selfDev_ = 0;
        private String serviceZone_;
        private int skipSwitch_ = 1;

        public int ˊ() {
            return this.isServiceZone_;
        }

        public int ॱ() {
            return this.maxDisplay_;
        }

        public int ˎ() {
            return this.oobeMarket_;
        }

        public int ˏ() {
            return this.isSimChangeNotify_;
        }

        public int ˋ() {
            return this.isNotifyNotRemoveable_;
        }

        public int ʽ() {
            return this.skipSwitch_;
        }

        public int ᐝ() {
            return this.appUpdateNotify_;
        }

        public int ʼ() {
            return this.selfDev_;
        }

        public String ʻ() {
            return this.channelInfo_;
        }

        public int ॱॱ() {
            return this.notifyIntervalTime_;
        }

        public String ͺ() {
            return this.desktopLayout_;
        }

        public String ॱˊ() {
            return this.serviceZone_;
        }
    }

    public static class c extends cvt {
        public static final String APIMETHOD = "client.oobeServiceJudge";
        private int changeID_ = -1;
        private String countryConfig_;
        private String deliverCountry_;
        private String mcc_;
        private String mnc_;
        private int needServiceZone_ = 1;
        private String phoneBuildNumber_;
        private String phoneType_;
        private String sn_;
        private String vendorConfig_;
        private String version_;
        private String vnk_;

        public static RequestStrategy ˎ() {
            RequestStrategy cVar = new RequestStrategy();
            cVar.setMethod_(APIMETHOD);
            return cVar;
        }

        public boolean isNeedRecallFront() {
            return false;
        }

        public void ˏ(String str) {
            this.deliverCountry_ = str;
        }

        public void ˎ(String str) {
            this.mnc_ = str;
        }

        public void ˊ(String str) {
            this.mcc_ = str;
        }

        public void ˋ(String str) {
            this.sn_ = str;
        }

        public void ॱ(String str) {
            this.phoneType_ = str;
        }

        public void ॱॱ(String str) {
            this.version_ = str;
        }

        public void ᐝ(String str) {
            this.phoneBuildNumber_ = str;
        }

        public String ˋ() {
            return this.vnk_;
        }

        public void ʼ(String str) {
            this.vnk_ = str;
        }

        public void ˊ(int i) {
            this.changeID_ = i;
        }

        public void ʻ(String str) {
            this.vendorConfig_ = str;
        }

        public void ʽ(String str) {
            this.countryConfig_ = str;
        }
    }

    public OOBEQueryIfSupportTaskV2(Context context, int i) {
        super(context);
        this.ॱ = i;
    }

    public cvt ˏ() {
        cvt ˎ = c.ˎ();
        ˎ.setSign_(null);
        ˎ.ˏ(dld.ˎ().ॱˋ());
        ˎ.setLocale_(doi.ॱ());
        ˎ.ॱ(Build.MODEL);
        ˎ.setServiceType_(0);
        Context ˋ = ContentManager.getInstant().getContext();
        try {
            ˎ.ॱॱ(ˋ.getPackageManager().getPackageInfo(ˋ.getPackageName(), 0).versionName);
        } catch (NameNotFoundException e) {
            Logger.ˎ("OOBE", "getPackageInfo exception");
        }
        ˎ.ʼ(dli.ˏ());
        ˎ.ˊ(dli.ॱˊ(ˋ));
        ˎ.ᐝ(dli.ˏ(ˋ) ? dli.ˎ() : "");
        ˎ.ˋ(dli.ᐝ());
        ˎ.ʻ(dli.ʽ());
        ˎ.ʽ(dli.ॱॱ());
        ˎ.ˊ(bke.ˎ());
        ˎ.ˎ(bke.ˏ());
        return ˎ;
    }

    public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
        boolean z = false;
        Context ˋ = ContentManager.getInstant().getContext();
        Intent intent = new Intent("com.huawei.appmarket.oobe.ACTION_SUPPORT_QUERY_FINISHED");
        intent.addFlags(268435456);
        intent.putExtra("fromWhere", this.ॱ);
        if (responseBean != null) {
            OOBESupportResponseV2 oOBESupportResponseV2 = (OOBESupportResponseV2) responseBean;
            if (oOBESupportResponseV2.getResponseCode() == 0 && oOBESupportResponseV2.getRtnCode_() == 0) {
                z = oOBESupportResponseV2.ˊ() == 1;
                int ॱ = oOBESupportResponseV2.ॱ();
                boolean z2 = oOBESupportResponseV2.ˏ() == 1;
                boolean z3 = oOBESupportResponseV2.ˋ() == 1;
                boolean z4 = oOBESupportResponseV2.ʽ() == 1;
                boolean z5 = oOBESupportResponseV2.ᐝ() == 1;
                int max = Math.max(oOBESupportResponseV2.ॱॱ(), 14);
                String ͺ = oOBESupportResponseV2.ͺ();
                Object obj = oOBESupportResponseV2.ʼ() == 1 ? 1 : null;
                String ʻ = oOBESupportResponseV2.ʻ();
                int ˎ = oOBESupportResponseV2.ˎ();
                String ॱˊ = oOBESupportResponseV2.ॱˊ();
                Logger.ˎ("OOBE", "OOBEQueryIfSupportTaskV2 isSupport=" + z);
                intent.putExtra("maxDisplay", ॱ);
                intent.putExtra("simChangeNotify", z2);
                intent.putExtra("notificationNotRemovable", z3);
                intent.putExtra("notificationFlowSupport", z4);
                intent.putExtra("appUpdateNotify", z5);
                intent.putExtra("appListCheckIntervalTime", max);
                intent.putExtra("policy", obj != null ? 1 : 2);
                intent.putExtra("channelInfo", ʻ);
                intent.putExtra("isOpenChannel", ˎ == 1 ? "1" : "0");
                if (ͺ != null && dli.ˏ(ˋ) && z) {
                    if (ͺ.length() < 524288000) {
                        intent.putExtra("layoutData", ͺ);
                    } else {
                        Logger.ˋ("OOBE", "too much layout data, ignore");
                    }
                }
                dld.ˎ().ˎ(((c) o_cvu).ˋ());
                if (!(TextUtils.isEmpty(ॱˊ) || dld.ˎ().ॱˋ().equals(ॱˊ))) {
                    epr.ˎ().ˋ(ॱˊ);
                    Logger.ˎ("OOBE", "OOBESupportRequestV2 serviceZone updated to " + ॱˊ);
                }
                dli.ˊ(ˋ).edit().putString("serviceZone", ॱˊ).commit();
            } else {
                Logger.e("OOBE", "OOBEQueryIfSupportTaskV2 failed. responseCode=" + oOBESupportResponseV2.getResponseCode() + " returnCode=" + oOBESupportResponseV2.getRtnCode_());
            }
        }
        intent.putExtra("isSupport", z);
        ll.ˏ(ˋ).ˋ(intent);
    }
}
